package applet;

import beans.Player_Bean;
import beans.User_Bean;
import client.Client_Service;
import java.io.IOException;
import java.util.Vector;
import javax.swing.DefaultListModel;
/**********************************************************************
*
* Filename: Draft_Applet.java
*
* File Description:
* GUI that is embedded into a web browser for the user to use for the live
* draft function
*
* Author:
* @author Tim Schmalz
* Date Created:
*  Oct 9, 2009
*
**********************************************************************/
public class Draft_Applet extends javax.swing.JApplet {

    Client_Service clientService;
    DefaultListModel model = new DefaultListModel();

    /** Initializes the applet Draft_Applet */
    @Override
    public void init() {
        try {
            java.awt.EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    initComponents();
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /** This method is called from within the init() method to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtServerMessages = new javax.swing.JTextArea();
        pnlLogin = new javax.swing.JPanel();
        txtPassword = new javax.swing.JPasswordField();
        cmdLogin = new javax.swing.JButton();
        txtUserName = new javax.swing.JTextField();
        lblLogin = new javax.swing.JLabel();
        txtLeague = new javax.swing.JTextField();
        lblLeague = new javax.swing.JLabel();
        lblTeam = new javax.swing.JLabel();
        lblPassword = new javax.swing.JLabel();
        pnlPlayers = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        lblLastPlayerDrafted = new javax.swing.JLabel();
        lstPlayer = new javax.swing.JScrollPane();
        lstPlayers = new javax.swing.JList();
        cmdAddPlayer = new javax.swing.JButton();
        pnlMyPlayers = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        lstMyPlayers = new javax.swing.JList();
        pnlOnTheClock = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        lblOnClockTeam = new javax.swing.JLabel();
        lblTimer = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        lblOnDeck1 = new javax.swing.JLabel();
        lblOnDeck2 = new javax.swing.JLabel();

        setBackground(new java.awt.Color(0, 0, 0));
        setForeground(new java.awt.Color(255, 255, 255));

        jPanel1.setBackground(new java.awt.Color(0, 0, 0));

        txtServerMessages.setColumns(20);
        txtServerMessages.setEditable(false);
        txtServerMessages.setFont(new java.awt.Font("Monospaced", 0, 10));
        txtServerMessages.setRows(5);
        jScrollPane1.setViewportView(txtServerMessages);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)
                .addContainerGap())
        );

        pnlLogin.setBackground(new java.awt.Color(0, 0, 0));

        cmdLogin.setBackground(new java.awt.Color(204, 204, 204));
        cmdLogin.setText("Login");
        cmdLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdLoginActionPerformed(evt);
            }
        });

        lblLogin.setBackground(new java.awt.Color(204, 204, 204));
        lblLogin.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
        lblLogin.setForeground(new java.awt.Color(255, 255, 255));
        lblLogin.setText("Please Login");

        lblLeague.setForeground(new java.awt.Color(254, 254, 254));
        lblLeague.setText("League");

        lblTeam.setForeground(new java.awt.Color(254, 254, 254));
        lblTeam.setText("Team");

        lblPassword.setForeground(new java.awt.Color(254, 254, 254));
        lblPassword.setText("Password");

        javax.swing.GroupLayout pnlLoginLayout = new javax.swing.GroupLayout(pnlLogin);
        pnlLogin.setLayout(pnlLoginLayout);
        pnlLoginLayout.setHorizontalGroup(
            pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLoginLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblLogin)
                    .addComponent(txtPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                    .addComponent(cmdLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                    .addComponent(lblLeague)
                    .addComponent(txtLeague, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                    .addComponent(lblTeam)
                    .addComponent(txtUserName, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                    .addComponent(lblPassword))
                .addContainerGap())
        );
        pnlLoginLayout.setVerticalGroup(
            pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLoginLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblLogin)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblLeague)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtLeague, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblTeam)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblPassword)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cmdLogin)
                .addContainerGap())
        );

        pnlPlayers.setBackground(new java.awt.Color(0, 0, 0));

        jLabel1.setBackground(new java.awt.Color(204, 204, 204));
        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("Last Player Drafted:");

        lblLastPlayerDrafted.setBackground(new java.awt.Color(204, 204, 204));
        lblLastPlayerDrafted.setFont(new java.awt.Font("Tahoma", 1, 12));
        lblLastPlayerDrafted.setForeground(new java.awt.Color(255, 255, 255));
        lblLastPlayerDrafted.setText(" ");

        lstPlayers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        lstPlayers.setEnabled(false);
        lstPlayer.setViewportView(lstPlayers);

        cmdAddPlayer.setText("Add Player");
        cmdAddPlayer.setEnabled(false);
        cmdAddPlayer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdAddPlayerActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlPlayersLayout = new javax.swing.GroupLayout(pnlPlayers);
        pnlPlayers.setLayout(pnlPlayersLayout);
        pnlPlayersLayout.setHorizontalGroup(
            pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPlayersLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlPlayersLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblLastPlayerDrafted, javax.swing.GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE))
                    .addComponent(cmdAddPlayer)
                    .addComponent(lstPlayer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 454, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlPlayersLayout.setVerticalGroup(
            pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPlayersLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(lblLastPlayerDrafted))
                .addGap(1, 1, 1)
                .addComponent(lstPlayer, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cmdAddPlayer)
                .addContainerGap())
        );

        pnlMyPlayers.setBackground(new java.awt.Color(0, 0, 0));
        pnlMyPlayers.setForeground(new java.awt.Color(255, 255, 255));

        jLabel2.setBackground(new java.awt.Color(204, 204, 204));
        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Your Draft Picks");

        jScrollPane2.setViewportView(lstMyPlayers);

        javax.swing.GroupLayout pnlMyPlayersLayout = new javax.swing.GroupLayout(pnlMyPlayers);
        pnlMyPlayers.setLayout(pnlMyPlayersLayout);
        pnlMyPlayersLayout.setHorizontalGroup(
            pnlMyPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMyPlayersLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlMyPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 442, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addContainerGap(24, Short.MAX_VALUE))
        );
        pnlMyPlayersLayout.setVerticalGroup(
            pnlMyPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMyPlayersLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
                .addContainerGap())
        );

        pnlOnTheClock.setBackground(new java.awt.Color(0, 0, 0));

        jLabel3.setBackground(new java.awt.Color(204, 204, 204));
        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("On the Clock");

        lblOnClockTeam.setBackground(new java.awt.Color(255, 255, 0));
        lblOnClockTeam.setText(" ");
        lblOnClockTeam.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblOnClockTeam.setEnabled(false);
        lblOnClockTeam.setOpaque(true);

        lblTimer.setBackground(new java.awt.Color(255, 255, 0));
        lblTimer.setText(" ");
        lblTimer.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblTimer.setEnabled(false);
        lblTimer.setOpaque(true);

        jLabel4.setBackground(new java.awt.Color(204, 204, 204));
        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("On Deck");

        lblOnDeck1.setBackground(new java.awt.Color(255, 255, 255));
        lblOnDeck1.setText(" ");
        lblOnDeck1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblOnDeck1.setEnabled(false);
        lblOnDeck1.setOpaque(true);

        lblOnDeck2.setBackground(new java.awt.Color(255, 255, 255));
        lblOnDeck2.setText(" ");
        lblOnDeck2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblOnDeck2.setEnabled(false);
        lblOnDeck2.setOpaque(true);

        javax.swing.GroupLayout pnlOnTheClockLayout = new javax.swing.GroupLayout(pnlOnTheClock);
        pnlOnTheClock.setLayout(pnlOnTheClockLayout);
        pnlOnTheClockLayout.setHorizontalGroup(
            pnlOnTheClockLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlOnTheClockLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlOnTheClockLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlOnTheClockLayout.createSequentialGroup()
                        .addComponent(lblOnClockTeam, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblTimer, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE))
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
                    .addComponent(lblOnDeck1, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
                    .addComponent(lblOnDeck2, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlOnTheClockLayout.setVerticalGroup(
            pnlOnTheClockLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlOnTheClockLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlOnTheClockLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblOnClockTeam)
                    .addComponent(lblTimer))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblOnDeck1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblOnDeck2)
                .addContainerGap(559, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlLogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlMyPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pnlOnTheClock, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlOnTheClock, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pnlMyPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pnlLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Listens to the add button on the GUI and acts when clicked
     *
     * @param evt - Add button click event
     */
    private void cmdAddPlayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdAddPlayerActionPerformed
        try
        {
            Player_Bean temp = (Player_Bean)lstPlayers.getSelectedValue();
            addPlayerToRoster(temp);
            clientService.draftPlayer(temp.getPlayerId());
        }
        catch (IOException ex)
        {
            outputMessage("An error has occured during the player selection process");
        }

    }//GEN-LAST:event_cmdAddPlayerActionPerformed

    /**
     * Adds a players to the drafters team on the GUI
     *
     * @param newPlayer - Player information to be added
     */
    public void addPlayerToRoster(Player_Bean newPlayer)
    {
        model.addElement(newPlayer);
        repaintLists();
    }

    /**
     * Listens to the Login button on the GUI and acts when clicked
     *
     * @param evt - Login button click event
     */
    private void cmdLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLoginActionPerformed
        try
        {
            final String SERVER_ADDRESS = "orion.csl.mtu.edu";//"127.0.0.1";//
            try
            {
                clientService = new Client_Service(SERVER_ADDRESS,1129,this);
            }
            catch(Exception e)
            {
                outputMessage("Could not connect to server @ " + SERVER_ADDRESS);
                outputMessage(e.toString());
            }
            User_Bean user = new User_Bean();
            user.setLeagueName(txtLeague.getText());
            user.setUserName(txtUserName.getText());
            user.setPassword(txtPassword.getText());
            boolean isLoggedIn = clientService.login(user);
            //If user is able to log in... prep for draft
            if(isLoggedIn)
            {
                outputMessage("Login success full");
                outputMessage("Waiting on other league members...");
                //Hide the draft items
                pnlLogin.setVisible(false);
                //Set model for my players list
                lstMyPlayers.setModel(model);
            }
            //If users fails to log in prompt them
            else
            {
                outputMessage("Login failed");
                outputMessage("Please try again...");
                //Reset Login
                txtUserName.setText("");
                txtPassword.setText("");
            }
	}
	catch(Exception e)
	{
            e.printStackTrace();
            outputMessage("There has been an error in the login process");
            System.err.println("Error in login command");
	}
    }//GEN-LAST:event_cmdLoginActionPerformed

    /**
     * Outputs a string to the message box on the applet
     *
     * @param output - The string to be output
     */
    public void outputMessage(String output)
    {
        txtServerMessages.setText(output + "\n" + txtServerMessages.getText());
    }


    /**
     * Sets the lock on drafting
     *
     * @param isEnabled - New status of lock
     */
    public void setAppletUnlock(boolean isEnabled)
    {
        lstPlayers.setEnabled(isEnabled);
        cmdAddPlayer.setEnabled(isEnabled);
    }

    /**
     * Sets player list
     *
     * @param players - list of players
     */
    public void setPlayerList(Vector<Player_Bean> players)
    {
        lstPlayers.setListData(players);
        repaintLists();
    }

    /**
     * Sets Last picked
     *
     * @param players - list of players
     */
    public void setLastPicked(String lastPicked)
    {
        lblLastPlayerDrafted.setText(lastPicked);
    }

    /**
     * Sets the timer
     *
     * @param players - list of players
     */
    public void setTimer(int newTime)
    {
        lblTimer.setText(newTime + "");
    }

    /**
     * Set on deck
     *
     * @param players - list of players
     */
    public void setOnDeck(String onTheClock, String onDeck, String inTheHole)
    {
        lblOnClockTeam.setText(onTheClock);
        lblOnDeck1.setText(onDeck);
        lblOnDeck2.setText(inTheHole);
    }

    /**
     * Repaints the list.  Added in an attempt to fix the large white area error.
     */
    public void repaintLists()
    {
        lstPlayers.repaint();
        lstMyPlayers.repaint();
    }

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cmdAddPlayer;
    private javax.swing.JButton cmdLogin;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblLastPlayerDrafted;
    private javax.swing.JLabel lblLeague;
    private javax.swing.JLabel lblLogin;
    private javax.swing.JLabel lblOnClockTeam;
    private javax.swing.JLabel lblOnDeck1;
    private javax.swing.JLabel lblOnDeck2;
    private javax.swing.JLabel lblPassword;
    private javax.swing.JLabel lblTeam;
    private javax.swing.JLabel lblTimer;
    private javax.swing.JList lstMyPlayers;
    private javax.swing.JScrollPane lstPlayer;
    private javax.swing.JList lstPlayers;
    private javax.swing.JPanel pnlLogin;
    private javax.swing.JPanel pnlMyPlayers;
    private javax.swing.JPanel pnlOnTheClock;
    private javax.swing.JPanel pnlPlayers;
    private javax.swing.JTextField txtLeague;
    private javax.swing.JPasswordField txtPassword;
    private javax.swing.JTextArea txtServerMessages;
    private javax.swing.JTextField txtUserName;
    // End of variables declaration//GEN-END:variables
  
}
